
const getDouyinList = async (id) => {
  if(!window.utools)return[];
  let res = await window.utools.ubrowser
  .goto("https://tophub.today/n/K7GdaMgdQy")
  // .devTools('right')
  .wait('table', 60000)
  .wait(200)
  .evaluate(() => {
    let hotList = [...document.querySelector('table').querySelectorAll('tr')];
    let arr = hotList.map((item, index) => {
      const infos = item.querySelectorAll('td');
      let url = infos[1].querySelector('a').href;
      let articleNumber = index + 1;
      let articleDetail = infos[1].querySelector('a').innerText;
      let hotNumber = infos[2].innerText;

      return {
        url,
        index: articleNumber,
        detail: articleDetail,
        hot: hotNumber,
      };
    });
    return arr;
  })
  .run({ show: false });
  // .run({ width: 1300, height: 1000 });
  window.utools.clearUBrowserCache();
  return {
    id,
    list: res[0],
  }
};


export { getDouyinList };